package com.aiti.lulian.controller;


import com.aiti.base.core.base.controller.WebController;
import com.aiti.base.core.utils.message.Message;
import com.aiti.lulian.dto.ActivitySummaryDto;
import com.aiti.lulian.entity.ActivitySummary;
import com.aiti.lulian.entity.LuLianDockingMeetingPurchaserSignupInformation;
import com.aiti.lulian.service.IActivitySummaryService;
import com.aiti.lulian.vo.EnterpriseAuthVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jsoup.helper.StringUtil;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("zj")
public class ActivitySummaryController extends WebController {

    private IActivitySummaryService activitySummaryService;

    public ActivitySummaryController(IActivitySummaryService activitySummaryService) {
        this.activitySummaryService = activitySummaryService;
    }

    @PostMapping("/uploadZj")
    public Message uploadZj(@RequestBody ActivitySummary activitySummary){
        return activitySummaryService.uploadZj(activitySummary);
    }


    @GetMapping("/queryShowData")
    public Message queryShowData(@RequestParam("id") String id){
        return activitySummaryService.queryShowData(id);
    }

    /***
     * 查询上传总结列表
     * @param dto
     * @return
     */
    @GetMapping("/getZjList")
    public Message getZjList(ActivitySummaryDto dto){
        Integer pageSize = dto.getPageSize();
        Integer pageNum = dto.getPageNum();
        Page<ActivitySummary> page = startPage(pageNum,pageSize);
        List<ActivitySummary> zjList = activitySummaryService.getZjList(page, dto);
        return Message.success(getPageResult(zjList,pageNum,pageSize,(int)page.getTotal()));
    }

    @PostMapping("/updateCheckStatus")
    public Message updateCheckStatus(@RequestBody ActivitySummary activitySummary){
        if(StringUtil.isBlank(activitySummary.getBaseId())){
            return Message.fail("没有找到主键");
        }
        if(StringUtil.isBlank(activitySummary.getStatus())){
            return Message.fail("请传入状态标识");
        }
        activitySummaryService.updateCheckStatus(activitySummary);
        return Message.success();
    }
}
